<?php
class dbhelper {
	
	protected $db_name = 'new_prideelu_battlescript';
	protected $db_user = 'root';
	protected $db_pass = '';
	protected $db_host = 'localhost';
	protected $connection;
	
	public function dbhelper() {
		$this->connection = @mysql_connect($this->db_host, $this->db_user, $this->db_pass); 
		@mysql_select_db($this->db_name); 
	}
	
	function execQuery($query) {
		@mysql_query("SET NAMES 'utf8'", $this->connection);
		$_select = @mysql_query($query,$this->connection);
		return $_select;	
	}
	function getNumRows($result)
	{
		return @mysql_num_rows($result); 
	}	
	
	function getAffectedRows()
	{
		return @mysql_affected_rows($this->connection); 
	}	
	
	function fetchArray($result)
	{
		return mysql_fetch_array($result);
	}
	
	function fetchObject($result, $className = "")
	{
		if($className == "")
			return @mysql_fetch_object($result);
		else
			return @mysql_fetch_object($result, $className);
	}
	
	function getInsertID()
	{
		return @mysql_insert_id();
	}
	
	function destruct()
	{
		@mysql_close($this->connection);
	}
}
?>